﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="pos.aspx.cs" Inherits="TCDC_System.Content.TransectionData.pos" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<%@ Register TagPrefix="uc" Src="~/UserControl/UserAdd.ascx" TagName="UserAdd" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <script type="text/javascript">
        var exportData = function (GridData, GridPanel) {
            GridData.setValue(Ext.encode(GridPanel.getRowsValues({ selectedOnly: false })));
        };
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <ext:ResourceManager ID="mainResource" runat="server" CleanResourceUrl="false" />
    <ext:Hidden ID="GridData" runat="server" />
    <ext:Viewport ID="Viewport1" runat="server" Layout="border">
        <Items>
            <ext:FormPanel ID="FormPanel2" runat="server" Region="Center" 
                Split="true" Title="POS" BodyStyle="background-color: #DFE8F6" Padding="10" LabelWidth="100"
                Icon="TableGear" Width="600">
                <TopBar>
                    <ext:Toolbar ID="Toolbar1" runat="server">
                        <Items>
                            <ext:ToolbarFill ID="ToolbarFill1" runat="server" />
                            <ext:Button ID="btSave" runat="server" Icon="Disk" Text="Save" OnDirectClick="SavePos" />
                            <ext:Button ID="btCancle" runat="server" Text="Cancle" Icon="Delete" />
                        </Items>
                    </ext:Toolbar>
                </TopBar>
                <Items>
                    <ext:FieldSet ID="FieldSetCashFund" runat="server" Title="เพิ่มรายการสินค้า" Collapsible="true"
                        Collapsed="true" Layout="form" LabelWidth="90" Padding="8">
                        <Items>
                            <ext:ComboBox ID="VendorEntityID" runat="server" FieldLabel="สินค้า" Editable="false"
                                Width="600" />
                            <ext:CompositeField ID="CompositeField3" runat="server" FieldLabel="ราคา" CombineErrors="false">
                                <Items>
                                    <ext:TextField ID="TextField1" runat="server" Width="190" />
                                    <ext:DisplayField ID="DisplayField2" runat="server" Text="จำนวน" />
                                    <ext:TextField ID="billNumber" runat="server" Width="190" />
                                    <ext:DisplayField ID="DisplayField4" runat="server" Text="รวม" />
                                    <ext:NumberField ID="Labour_Fee" runat="server" Width="120" />
                                    <ext:DisplayField ID="DisplayField5" runat="server" Text="บาท" />
                                </Items>
                            </ext:CompositeField>
                        </Items>
                    </ext:FieldSet>
                    <ext:GridPanel ID="GridPanel1" runat="server" Region="Center" DDGroup="gridDDGroup"
                        EnableDragDrop="false" StripeRows="true" AutoExpandColumn="PartID" AutoExpandMin="50"
                        Frame="true" Height="350" Title="รายการสินค้าที่ซื้อ" Icon="CartAdd">
                        <Store>
                            <ext:Store runat="server" ID="Store1">
                                <Reader>
                                    <ext:JsonReader IDProperty="PartID">
                                        <Fields>
                                            <ext:RecordField Name="PartID" />
                                            <ext:RecordField Name="PartCode" />
                                            <ext:RecordField Name="PartName" />
                                            <ext:RecordField Name="poQuantity" />
                                            <ext:RecordField Name="poUnit_Price" />
                                            <ext:RecordField Name="poAmount" />
                                            <ext:RecordField Name="poTotal_Discount" />
                                            <ext:RecordField Name="AmountAfterDiscount" />
                                            <ext:RecordField Name="poTotal_Vat" />
                                            <ext:RecordField Name="AmountIncludeVat" />
                                            <ext:RecordField Name="Unit_Cost" />
                                        </Fields>
                                    </ext:JsonReader>
                                </Reader>
                            </ext:Store>
                        </Store>
                        <ColumnModel>
                            <Columns>
                                <ext:RowNumbererColumn />
                                <ext:Column Header="PartID" DataIndex="PartID" Hidden="true" />
                                <ext:Column Header="รหัสสินค้า" DataIndex="PartCode" Width="100" Align="Center" />
                                <ext:Column Header="รายการ" DataIndex="PartName" Width="200" />
                                <ext:Column Header="จำนวน" DataIndex="poQuantity" Width="100" Align="Right" />
                                <ext:Column Header="หน่วยละ" DataIndex="poUnit_Price" Width="100" Align="Right" />
                                <ext:Column Header="จำนวนเงิน" DataIndex="poAmount" Width="100" Align="Right" />
                                <ext:Column Header="ส่วนลด" DataIndex="poTotal_Discount" Width="80" Align="Right" />
                                <ext:Column Header="จำนวนเงินหลังหักส่วนลด" DataIndex="AmountAfterDiscount" Width="125"
                                    Align="Right" />
                                <ext:Column Header="ภาษีมูลค่าเพิ่ม" DataIndex="poTotal_Vat" Width="90" Align="Right" />
                                <ext:Column Header="จำนวนเงินรวมทั้งสิ้น" DataIndex="AmountIncludeVat" Width="120"
                                    Align="Right" />
                                <ext:Column Header="ต้นทุนต่อหน่วย" DataIndex="Unit_Cost" Width="100" Align="Right" />
                            </Columns>
                        </ColumnModel>
                        <BottomBar>
                            <ext:PagingToolbar ID="PagingToolbar1" runat="server" PageSize="19" DisplayInfo="true"
                                EmptyMsg="No Request to display" />
                        </BottomBar>
                    </ext:GridPanel>
                    <ext:Panel ID="Panel3" runat="server" Frame="true" Title="+-" LabelWidth="250" Layout="Form"
                        Height="200" Padding="15" Icon="Sum">
                        <Items>
                            <ext:CompositeField ID="CompositeField6" runat="server" FieldLabel="รวมเป็นเงิน Sub Total"
                                AnchorHorizontal="95%">
                                <Items>
                                    <ext:DisplayField ID="DisplayField1" runat="server" Flex="1" Html="&nbsp;" />
                                    <ext:NumberField ID="SubTotal" runat="server" IndicatorText="บาท" ReadOnly="true" />
                                </Items>
                            </ext:CompositeField>
                        </Items>
                    </ext:Panel>
                </Items>
            </ext:FormPanel>
            <ext:FormPanel ID="FormPanelDataBasic" runat="server" Region="East" Collapsible="true"
                Collapsed="true" Split="true" Width="200" MinWidth="225" Layout="Fit" Title="Data Basic"
                BodyStyle="background-color: #DFE8F6" Padding="5" LabelWidth="50" Icon="Folder">
                <Items>
                    <ext:Label runat="server" ID="lbComment" />
                </Items>
            </ext:FormPanel>
        </Items>
    </ext:Viewport>
    <uc:UserAdd ID="UserAdd1" runat="server" />
    </form>
</body>
</html>
